<%@page import="com.portal4kids.model.Party"%>
<%@page import="com.portal4kids.controller.PartyManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="stars/mx_stars.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" href="css/search_style.css">
<script type="text/javascript" src="stars/mx_stars.js"></script>
<link rel="stylesheet" href="css/detail_style.css">
<!-- <script type="text/javascript" src="js/prototype.js"></script> -->
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<title>Portal for kids</title>
<style>
		body { font-size: 62.5%; color:white;}
		label, input { display:block; }
		input.text { margin-bottom:12px; width:95%; padding: .4em; }
		fieldset { padding:0; border:0; margin-top:25px; }
		h1 { font-size: 1.2em; margin: .6em 0; }
		div#users-contain { width: 775px; margin-left: auto; margin-right: auto;  text-align: left; font-family: Arial;font-size: 12px;}
		
		.ui-dialog .ui-state-error { padding: .3em; }
		.validateTips { border: 1px solid transparent; padding: 0.3em; }
	</style>
<script type="text/javascript">
$(document).ready(function(){
    $('#rate').stars();
});
</script>
</head>
<body background="images/bg_search.jpg">
<div id="top">
 <ul id=menu>
       <li><a href="index.jsp">home</a></li>
      <li><a href="baner/newses.jsp">aktualności</a></li>

      <li><a href=#>oceny</a></li>
      <li><a href="baner/aboutAs.jsp">o nas</a></li>
      <li><a href="baner/contact.jsp">kontakt</a></li>
    </ul>
</div>

<%

if(request.getParameter("rate") == null || request.getParameter("rate") == ""){


}
else{
	
	int rank = Integer.parseInt(request.getParameter("rate"));
	int id = Integer.parseInt(request.getParameter("id"));
	System.out.print("not null" + rank + " " + id);
	PartyManager.addRank(id, rank);
}

%>



<%  int id = Integer.parseInt(request.getParameter("id")); %>
<%  PartyManager pm = new PartyManager();
    List <Party> detailsPeople = pm.getPartyAfterID(id);
    int avarage = detailsPeople.iterator().next().getAvarage();
    int lg = detailsPeople.iterator().next().getNumberOfVotes();
%>

<% 	String zrodlo = detailsPeople.iterator().next().getId_party()+ "PartyProfilowe.jpg" ;
					String sciezka = "ftp://misiekmk:stfzv6095@ftp.misiekmk.linuxpl.info/portal4kids/" + zrodlo;
			
%>
	<div id="users-contain" class="ui-widget">	
	<a href="javascript:history.back()">powrót</a><br><br>	
	<div id="d_all">
      <div id="d_top">
     
             <div class="d_a">
              <div class="a">Nazwa</div>
             </div>
             <div class="d_b">
                <div class="b"><%= detailsPeople.iterator().next().getName() %></div>
             </div>
             <div class="d_a">
                <div class="a">Dzielnica</div>
             </div>
             <div class="d_b">
                <div class="b"><%= detailsPeople.iterator().next().getAddress() %></div>
             </div>
             <div class="d_a">
                <div class="a">Typ</div>
             </div>
             <div class="d_b">
                <div class="b"><%= detailsPeople.iterator().next().getType() %></div>
             </div>
        
      </div>
      
      <div id="d_bottom">
        <div id="d_bottom_img">
        <a href="<%=sciezka%>" rel="lightbox">
          <img alt="Brak zdjecia" src="<%=sciezka%>"width="124px;" height="90px" >
         </a>
        </div>
        <div id="d_bottom_txt">
        <%=detailsPeople.iterator().next().getDescription() %>
        </div>
        <div id="gwiazdki">
        

      	<form action="showPlacesDetails.jsp" method="GET">
	            <input name="rate" id="rate" value="<%out.print(avarage);%>" />
	           
	            <input type="hidden" name="id" value="<% out.print(id); %>" />
	            <button class="classname" type="submit">Głosuj</button>
	            
	          </form>
        
        
        </div>
      </div>
  </div>
	
</div>	

</body>
</html>